<template>
  <div>
    <myheader title="我的页面" rightBtn="主页" @updataInfo="goHome"></myheader>
    <div class="my">
      <!-- 我的资料 -->
      <div class="header" style="margin-top: 1.5rem;">
        <!-- 存放头像· -->
        <div class="img" @click="edithedaImg">
          <img
            :src="headerImg ? headerImg:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.51yuansu.com%2Fpic3%2Fcover%2F03%2F01%2F85%2F5ae6d45066caa_610.jpg&refer=http%3A%2F%2Fpic.51yuansu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1633415530&t=e565d94f239cf0b1d879c03f3a77838a' "
          />
        </div>

        <!-- 存放个人信息 -->
        <div class="user">
          <li class="name">账号：{{user.username}}</li>
          <li class="mail">邮箱：{{user.email}}</li>
        </div>
      </div>

      <!-- 所在社区 -->
      <div class="village" style="margin-top:2.4rem;">
        <li>姓名：{{user.username}}</li>
        <li class="village_li">
          <!-- <span class="li_lift">所属社区：{{user.village}}</span> -->
          <span class="li_lift">所属社区：{{user.village}}</span>
          <span class="li_right">
            <router-link to="/authentication" class="li_right_a" style="color: #FFFFFF;">
              <van-icon name="award" />
              <span>社区认证</span>
              <van-icon name="arrow" />
            </router-link>
          </span>
        </li>
      </div>
    </div>
    <!-- 可滑动部分 -->
    <div class="conten">
      <!-- 个人展示 -->
      <myuser></myuser>
      <!-- 更多 -->
      <my-more></my-more>
    </div>
  </div>
</template>

<script>
import myuser from '../components/my/myuser.vue'
import myMore from '../components/my/myMore.vue'
import myheader from '../comon/myheader.vue'

export default {
  components: {
    myuser,
    myMore,
    myheader,
  },
  data() {
    return {
      user: {},
      headerImg: '',
    }
  },

  created() {
    // 从vuex中获取用户数据
    this.user = this.$store.getters.getUserInfo
    this.headerImg = this.$store.getters.getUserInfo.avatar
  },

  methods: {
    // 跳珠到首页
    goHome() {
      this.$router.push('/home')
    },
    // 跳转编辑页面
    edithedaImg() {
      this.$router.push('/myUpdateHeader')
    },
  },
}
</script>

<style scoped>
.van-nav-bar__content {
  background: #39a9ed !important;
}
.custom-image .van-empty__image {
  width: 90px;
  height: 90px;
}

.my {
  margin-bottom: 35px;
  min-height: calc(100vh - 1.25rem);
  position: fixed;
  width: 100%;
  margin-top: 46px;
  background: url(https://img0.baidu.com/it/u=1353201629,2000011069&fm=26&fmt=auto&gp=0.jpg)
    no-repeat;
  background-attachment: fixed;
  background-size: 100vw;
}
.header {
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: left;
  box-sizing: border-box;
  align-items: center;
  position: fixed;
  top: 0;
}
/* 存放头像的div */
.img {
  height: 70px;
  width: 70px;
  margin-left: 10px;
  margin-right: 10px;
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}
.img > img {
  height: 60px;
  width: 60px;
  border-radius: 50%;
}
/* 存放个人信息 */
.user {
  /* height: 100%; */
  flex: 1;
}
.name {
  color: #ffffff;
  font-size: 18px;
  font-weight: bold;
}
.mail {
  font-size: 14px;
  color: #dddddd;
}
/* 我的小区 */
.village {
  /* background: #39A9ED; */
  /* height:40px; */
  width: 100%;
  font-size: 16px;
  padding-left: 25px;
  padding-right: 25px;
  padding-bottom: 15px;
  color: #ffffff;
  /* background: transparent; */
}
.village > .village_li {
  font-size: 10px;
  display: flex;
  align-items: center;
}
.li_lift {
  flex: 1;
}
.li_right_a {
  text-align: right;
  color: #ffffff;
}
/* 可滑动部分 */
.conten {
  position: absolute;
  z-index: 33;
  border-radius: 24px 24px 0 0;
  height: 100vh;
  width: 100%;
  top: 35%;
  height: 80vh;
  background: #fff;
}
</style>
